﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CY.Utility.Common
{
    public static class FileUtility
    {
        public static string GetFileExtension(string fileName)
        {
            if (string.IsNullOrEmpty(fileName))
                return String.Empty;

            int dotIndex = fileName.LastIndexOf('.');

            return fileName.Substring(dotIndex).ToLower();
        }

        public static string GetFileName(string fileName)
        {
            if (string.IsNullOrEmpty(fileName))
                return String.Empty;

            int dotIndex = fileName.LastIndexOf('.');

            if (dotIndex < 0)
            {
                return String.Empty;
            }
            return fileName.Substring(0, dotIndex);
        }

    }
}
